public class Account {
    private final int id;
    private int balance;
    private int transactionNum;

    public Account(int id, int initialBalance) {
        this.id = id;
        this.balance = initialBalance;
        this.transactionNum = 0;
    }

    public synchronized void transferTo(Account target, int amount) {
        if (this.balance >= amount) {
            this.balance -= amount;
            target.balance += amount;
            this.transactionNum++;
            target.transactionNum++;
        }
    }

    public int getId() {
        return id;
    }

    public int getBalance() {
        return balance;
    }

    public int getTransactionNum() {
        return transactionNum;
    }
}